function okOnClick() {
	var tabletools = TableTools.fnGetInstance('table');
	var list = new Array();
	list = tabletools.fnGetSelected();
	var selectedValue = '';
	var editId = '';
	var editCity = '';
	var editState = '';
	var editCountry = '';

	for ( var i = 0; i < tabletools.fnGetSelected().length; i++) {
		var value = tabletools.fnGetSelected()[i].getElementsByTagName("td")[0].innerHTML;
		// selectedValue += value + ';'
		selectedValue = value;
		editId = value;
		editCity = tabletools.fnGetSelected()[i].getElementsByTagName("td")[1].innerHTML;
		editState = tabletools.fnGetSelected()[i].getElementsByTagName("td")[2].innerHTML;
		editCountry = tabletools.fnGetSelected()[i].getElementsByTagName("td")[3].innerHTML;

	}
	// alert(selectedValue);
	$("[id='locations_form:selected_value']").val(selectedValue);
	$("[id='locations_form:selected_id']").val(editId);
	$("[id='locations_form:selected_city']").val(editCity);
	$("[id='locations_form:selected_state']").val(editState);
	$("[id='locations_form:selected_country']").val(editCountry);

	$("[id='locations_form:edit_id']").val(editId);
	$("[id='locations_form:edit_city']").val(editCity);
	$("[id='locations_form:edit_state']").val(editState);
	$("[id='locations_form:edit_country']").val(editCountry);

	if (selectedValue == '') {
		alert("Please select a row first!")
	} else {
		$("#dialog-form").dialog("open");
	}
	return false;
}

function createOnClick() {
	clearFields();
	$("#dialog_form_create").dialog("open");
	return false;

}

function clearFields() {

	$("[id='locations_form:selected_id']").val('');
	$("[id='locations_form:selected_city']").val('');
	$("[id='locations_form:selected_state']").val('');
	$("[id='locations_form:selected_country']").val('');
	$("[id='locations_form:create_city']").val('');
	$("[id='locations_form:create_state']").val('');
	$("[id='locations_form:create_country']").val('');

}